import request from "@/utils/request";
// const BASE_URL = "/v1/design/tasks";
const BASE_URL = "/design/schemes";

export function queryList(query) {
  return request({
    url: BASE_URL,
    method: "get",
    params: query,
  });
}
//方案新建（无模板）
export function createSchemes(wellId) {
  return request({
    url: BASE_URL,
    method: "post",
    data: { wellId }
  });
}

export function createOne(data) {
  return request({
    url: BASE_URL,
    method: "post",
    data: data,
  });
}

//方案查询
export function getOne(id) {
  return request({
    url: BASE_URL + '/' + id,
    method: "get",
  });
}
//方案数据查询
export function getDataOne(id) {
  return request({
    url: BASE_URL + "/" + id + "/data",
    method: "get",
  });
}

//方案数据更新
export function updateOne(schemeId, data) {
  return request({
    url: BASE_URL + "/" + schemeId + "/data",
    method: "put",
    data: data,
  });
}

//方案删除
export function deleteOne(schemeId) {
  return request({
    url: BASE_URL + "/" + schemeId,
    method: "delete",
  });
}
// 最新方案列表
export function getOneList(query) {
  return request({
    url: BASE_URL + '/latestList',
    method: "get",
    params: query,
  });
}
// 单井测前方案
// export function getOneHistory(wellId) {
//   return request({
//     url: 'design/' + wellId + "/schemes",
//     method: "get",
//   });
// }
export default {
  getOne,
  createSchemes,
  createOne,
  updateOne,
  queryList,
  getDataOne,
  deleteOne,
  getOneList,
}